package com.healthmgmt.app.controller;

import com.healthmgmt.app.domain.TopicalApplication;
import com.healthmgmt.app.service.ITopicalApplicationService;
import com.healthmgmt.common.core.controller.BaseController;
import com.healthmgmt.common.core.domain.AjaxResult;
import com.healthmgmt.common.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 贴敷Controller
 *
 * @author ruoyi
 * @date 2025-06-29
 */
@RestController
@RequestMapping("/app/topical-application")
public class TopicalApplicationController extends BaseController {
    @Resource
    private ITopicalApplicationService topicalApplicationService;

    /**
     * 查询贴敷列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TopicalApplication topicalApplication)
    {
        startPage();
        List<TopicalApplication> list = topicalApplicationService.selectTopicalApplicationList(topicalApplication);
        return getDataTable(list);
    }

    /**
     * 获取贴敷详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(topicalApplicationService.selectTopicalApplicationById(id));
    }

    /**
     * 新增贴敷
     */
    @PostMapping
    public AjaxResult add(@RequestBody TopicalApplication topicalApplication)
    {
        return toAjax(topicalApplicationService.insertTopicalApplication(topicalApplication));
    }

    /**
     * 修改贴敷
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TopicalApplication topicalApplication)
    {
        return toAjax(topicalApplicationService.updateTopicalApplication(topicalApplication));
    }

    /**
     * 删除贴敷
     */
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(topicalApplicationService.deleteTopicalApplicationByIds(ids));
    }
}
